<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns:jsf="http://xmlns.jcp.org/jsf"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://xmlns.jcp.org/jsf/html">   
    <h:form>
        <fieldset>
            <legend> Cadastro de Álbum </legend>
                <label for="titulo">Título:</label>
                <br/>
                <input required="true" type="text" jsf:value="${albumManagedBean.album.title}" name="titulo" size="30"/>
                <br/>
                <label for="year">Ano:</label>
                <br/>
                <input required="true" min="1500" type="number" max="${util.year}" jsf:value="${albumManagedBean.album.year}" name="year" />
                <br/>
                <label for="artista">Artista:</label>
                <br/>
                <select size="1" required="true" jsf:value="${albumManagedBean.album.artist.id}" name="artista">
                    <f:selectItem itemLabel="Selecione um artista" itemValue=""/>
                    <f:selectItems value="${artistManagedBean.list}" var="artist"
                                   itemValue="${artist.id}" itemLabel="${artist.name}"/>
                </select>
                <br/>
                <label for="gravadora">Gravadora:</label>
                <br/>
                <select size="1" required="true" jsf:value="${albumManagedBean.album.recorder.id}" name="gravadora">
                    <f:selectItem itemLabel="Selecione uma gravadora" itemValue=""/>
                    <f:selectItems value="${recorderManagedBean.list}" var="recorder"
                                   itemValue="${recorder.id}" itemLabel="${recorder.name}"/>
                </select>
                <br/>
                <br/>
                <input class="button" type="submit" jsf:reRender="listAlbuns" value="Salvar" jsf:action="${albumManagedBean.register()}"/>
                <input class="button" type="button" value="Cancelar" jsf:action="${albumManagedBean.cancelar()}"/>
        </fieldset> 
    </h:form>    
</html>

